/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejercicio2;

/**
 *
 * @author diego
 */
public class ColeccionPelis {
    
    
    private static String listaPeliculas [] = {"The Artist", "Hugo", "Biutiful", "Drive",
    "X-Men", "Torrente 4"};
    private static int puntos [][] = {{5,1,3,2,5}, {4,2,4,2,4}, {3,2,3,5,2}, 
        {3,3,1,3,5}, {1,4,2,2,1}, {2,5,3,4,2}};

    
    public static float calificacionPelicula (String pelicula) {
        int i=0, j;
        float total=0.0F;
     
        while (i<listaPeliculas.length && !listaPeliculas[i].contentEquals(pelicula))
            i++;
        
        if (i==listaPeliculas.length)
            throw new IllegalArgumentException("Pelicula no encontrada.");

        for (j=0; j<5; j++)
            total = total + puntos[i][j];
        
        total = total / 5;
        
        return total;
    }
}
